/***********************************************************
* 
*     File Name:  rrclient.cpp
* 
*        Author:  Algolc
* 
*          mail:  17360224@qq.com
* 
*  Created Time:  Wed 11 Jul 2018 12:25:38 PM CST
* 
***********************************************************/

#include <stdlib.h>
#include <zhelpers.h>

int main() {
    void* context = zmq_ctx_new();

    //用来与服务器交流的套接字
    void* requester = zmq_socket(context, ZMQ_REQ);
    
    zmq_connect(requester, "tcp://loaclhost:5559");

    for (int request_count = 0; request_count < 10; ++request_count) {
        s_send(requester, "hello");
        char* tmp_str = s_recv(requester);
        printf("Received reply %d [%s]\n", request_count, tmp_str);
        free(tmp_str);
    }

    zmq_close(requester);
    zmq_ctx_destroy(context);

    return 0;
}
